package com.example.bpmn.config;

import org.camunda.bpm.engine.RepositoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class ProcessDeploymentConfig {

    @Autowired
    private RepositoryService repositoryService;

    @PostConstruct
    public void deployProcesses() {
        // 部署所有流程定义
        repositoryService.createDeployment()
            .addClasspathResource("bpmn/sales-order.bpmn")
            .addClasspathResource("bpmn/supplier-order.bpmn")
            .addClasspathResource("bpmn/user-order.bpmn")
            .addClasspathResource("bpmn/warehouse-order.bpmn")
            .addClasspathResource("bpmn/order-merge.bpmn")
            .addClasspathResource("bpmn/delivery.bpmn")
            .addClasspathResource("bpmn/outbound.bpmn")
            .name("订单流程")
            .deploy();
    }
} 